{% extends 'base_children.html' %}
{% block self_head %}

{% endblock %}
{% block content %}
    <body class="auth-user">
    <div class="layui-fluid">

      <div class="layui-row">

 {% if datalist %}
                            {% include "include/pagejump/pagebutton.html" %}

                            <table id="mytable" class="layui-table" border="1">
                                <thead  class="layui-table-header">
                                <tr >
                                    {% for colname in colName %}
                                        <th>{{ colname }}</th>
                                    {% endfor %}
                                    <th></th>
                                </tr>
                                </thead>
                                <tbody   >
                                {% for item in datalist %}
                                    <tr>
                                        {% for item_detail in item %}
                                            <td> {{ item_detail |default_if_none:''|linebreaks}}</td>
                                        {% endfor %}
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>

       {% endif %}
      </div>
    </div>
    <!-- 加载js文件-->
    </body>

{% endblock %}

{% block self_foot %}

      {% include "include/pagejump/pagejump.html" %}
    {#    以下这种方式为什么不幸呢#}
    <script type="text/javascript">
        layui.config({
            version: "2.0.8",
            base: '/static/larryms/',
            layertype: 2, //iframe内层弹窗类型不显示返回首页
            rightMenu: false // false关闭，设置为custom时使用自定义，不使用默认menu
        }).extend({
            larry: 'js/base'
        }).use(['jquery', 'larry','table', 'layer', 'form'], function () {
            var $ = layui.$,
                larry = layui.larry,
                table = layui.talbe,
                larryms = layui.larryms,
                form = layui.form;

            var curIfr = parent.layer.getFrameIndex(window.name);
            $('#resetAdd').on('click', function () {
                $('#demoAddForm')[0].reset();
            });
            $('#closeAdd').on('click', function () {
                parent.layer.close(curIfr);
            });
            form.on('submit(demoadd)', function (data) {
                $.post(data.form.action, data.field, function (res) {
                    if (res.code == 200) {
                        larryms.msg(res.msg, {time: 350}, function () {
                            {#parent.table.reload('demo', {}); //刷新tableid ,中括号是针对分页，刷新某一页的数据时使用#}
                            parent.location.reload(); // ¸¸Ò³ÃæË¢ÐÂ
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.layer.close(curIfr);
                        })
                    } else if (res.code == 500) {
                        larryms.msg(res.msg);
                    }
                });
                return false;
            });
        });
    </script>

{% endblock %}
